<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui, viewport-fit=cover">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <title>My App</title>
    <link rel="stylesheet" href="../../packages/core/css/framework7.min.css">
    <link rel="stylesheet" href="../../css/framework7-icons.css">
  </head>
  <body>
    <div id="app"></div>
    <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
    <script src="https://unpkg.com/react@16.4.1/umd/react.production.min.js"></script>
    <script src="https://unpkg.com/react-dom@16.4.1/umd/react-dom.production.min.js"></script>
    <script src="../../packages/react/framework7-react.min.js"></script>
    <script src="../../packages/core/js/framework7.min.js"></script>
    <script type="text/babel">
      class AppComponent extends React.Component {
        constructor() {
          super();
      
          this.state = {
            gaugeValue: 0.5,
          };
        }
        render() {
          return (
            <App>
              <View main>
                <Page>
                  <Navbar title="Gauge"></Navbar>
                  <Block strong>
                    <p>Framework7 comes with Gauge component. It produces nice looking fully responsive SVG gauges.</p>
                  </Block>
                  <Block strong className="text-align-center">
                    <Gauge
                      type="circle"
                      value={this.state.gaugeValue}
                      size={250}
                      borderColor="#2196f3"
                      borderWidth={10}
                      valueText={`${this.state.gaugeValue * 100}%`}
                      valueFontSize={41}
                      valueTextColor="#2196f3"
                      labelText="amount of something"
                    />
                    <Segmented tag="p" raised>
                      <Button onClick={() => this.setState({ gaugeValue: 0 })}>0%</Button>
                      <Button onClick={() => this.setState({ gaugeValue: 0.25 })}>25%</Button>
                      <Button onClick={() => this.setState({ gaugeValue: 0.5 })}>50%</Button>
                      <Button onClick={() => this.setState({ gaugeValue: 0.75 })}>75%</Button>
                      <Button onClick={() => this.setState({ gaugeValue: 1 })}>100%</Button>
                    </Segmented>
                  </Block>
      
                  <BlockTitle>Circle Gauges</BlockTitle>
                  <Block strong>
                    <Row>
                      <Col className="text-align-center">
                        <Gauge
                          type="circle"
                          value={0.44}
                          valueText="44%"
                          valueTextColor="#ff9800"
                          borderColor="#ff9800"
                        />
                      </Col>
                      <Col className="text-align-center">
                        <Gauge
                          type="circle"
                          value={0.12}
                          valueText="$120"
                          valueTextColor="#4caf50"
                          borderColor="#4caf50"
                          labelText="of $1000 budget"
                          labelTextColor="#f44336"
                          labelFontWeight={700}
                        />
                      </Col>
                    </Row>
                  </Block>
                  <BlockTitle>Semicircle Gauges</BlockTitle>
                  <Block strong>
                    <Row>
                      <Col className="text-align-center">
                        <Gauge
                          type="semicircle"
                          value={0.3}
                          valueText="30%"
                          valueTextColor="#f44336"
                          borderColor="#f44336"
                        />
                      </Col>
                      <Col className="text-align-center">
                        <Gauge
                          type="semicircle"
                          value={0.5}
                          valueText="30kg"
                          valueTextColor="#e91e63"
                          borderColor="#e91e63"
                          labelText="of 60kg total"
                          labelTextColor="#333"
                        />
                      </Col>
                    </Row>
                  </Block>
                  <BlockTitle>Customization</BlockTitle>
                  <Block strong>
                    <Row>
                      <Col className="text-align-center">
                        <Gauge
                          type="circle"
                          value={0.35}
                          valueText="35%"
                          valueTextColor="#4caf50"
                          valueFontSize={51}
                          valueFontWeight={700}
                          borderWidth={20}
                          borderColor="#4caf50"
                          borderBgColor="#ffeb3b"
                          bgColor="#ffeb3b"
                        />
                      </Col>
                      <Col className="text-align-center">
                        <Gauge
                          type="circle"
                          value={0.67}
                          valueText="$670"
                          valueTextColor="#000"
                          borderColor="#ff9800"
                          labelText="of $1000 spent"
                          labelTextColor="#4caf50"
                          labelFontWeight={800}
                          labelFontSize={12}
                          borderWidth={30}
                        />
                      </Col>
                    </Row>
                    <br />
                    <Row>
                      <Col className="text-align-center">
                        <Gauge
                          type="semicircle"
                          value={0.5}
                          valueText="50%"
                          valueTextColor="#ffeb3b"
                          valueFontSize={41}
                          valueFontWeight={700}
                          borderWidth={10}
                          borderColor="#ffeb3b"
                          borderBgColor="transparent"
                        />
                      </Col>
                      <Col className="text-align-center">
                        <Gauge
                          type="semicircle"
                          value={0.77}
                          borderColor="#ff9800"
                          labelText="$770 spent so far"
                          labelTextColor="#ff9800"
                          labelFontWeight={800}
                          labelFontSize={12}
                          borderWidth={10}
                        />
                      </Col>
                    </Row>
                  </Block>
                </Page>
              </View>
            </App>
          )
        }
      }
    </script>
    <script>
      var theme = 'ios';
      if (location.href.indexOf('theme=md') >= 0) theme = 'md';
      
      if (Framework7.use) Framework7.use(Framework7React, { theme: theme });
      else if (Framework7.Class && Framework7.Class.use) Framework7.Class.use(Framework7React, { theme: theme });
      
      var plugin = {
        params: {
          theme: theme,
        }
      };
      
      if (Framework7.use) Framework7.use(plugin);
      else if (Framework7.Class && Framework7.Class.use) Framework7.Class.use(plugin);
      
      window.onload = function () {
        if (typeof AppComponent !== 'undefined') {
          ReactDOM.render(
            React.createElement(AppComponent),
            document.getElementById('app')
          );
        }
      }
    </script>
  </body>
</html>